package com.example.partner.adapter.team;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.example.partner.fragment.team.TeamAnnounceFragment;
import com.example.partner.fragment.team.TeamDetialFragment;
import com.example.partner.fragment.team.TeamMemberFragment;

import java.util.ArrayList;
import java.util.List;

public class TeamViewPagerAdapter extends FragmentStateAdapter {
    private final List<Fragment> fragmentList = new ArrayList<>();


    public TeamViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {

        // 根据位置返回对应的Fragment
        switch (position) {
            case 0:
                return new TeamDetialFragment();
            case 1:
                return new TeamAnnounceFragment();
            case 2:
                return new TeamMemberFragment();
        }
        return null;
    }

    @Override
    public int getItemCount() {
        return 3; // 标签总数
    }
}
